﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SqlCeDriver
{
	/*
		Class to hold constants
		SqlCommand is taken by ADO
	*/
	class Cmd
	{
		// [Specialise: define extension commands]
		public const String Descriptions = "DESCRIPTION";
		public const String EditDescriptions = "EDITDESCRIPTION";
		public const String Articles = "ARTS";
		public const String CopyTable = "COPYTABLE";
		public const String CreateTable = "CREATETABLE";
		public const String Publications = "PUBS";
		public const String DependencyTree = "DEPTREE";
		public const String LastProcessCommand = "LASTSQL";
		public const String QuickDiffDialog = "QUICKDIFFDLG";
		public const String DisplayHeldTable = "DISPLAYTABLE"; // this may be moved to the main framework
		public const String AddFK = "ADDFK";
		public const String DelFK = "DELFK";
		public const String ScriptClass = "ORM";

		// builder. creates a custom command and sets the action
		public static DbView.Command MakeCommand(String commandString)
		{
			// default is to make an extension command that populates a table
			DbView.Command command = new DbView.Command(DbView.Commands.Cmnd.Extension, commandString, DbView.Command.CommandAction.poptable);
			// [Specialise: override extension command action ]
			if (command.Name == EditDescriptions ||
				command.Name == CopyTable ||
				command.Name == Cmd.QuickDiffDialog ||
				command.Name == Cmd.AddFK ||
				command.Name == Cmd.DelFK ||
				command.Name == Cmd.CreateTable ||
				command.Name == Cmd.ScriptClass
				)
				command.Action = DbView.Command.CommandAction.driveraction;
			if (command.Name == DependencyTree ||
				command.Name == LastProcessCommand
				)
				command.Action = DbView.Command.CommandAction.text;
			
			return command;
		}
	}

	class CmdParam
	{
		// [Specialise: add defined parameters ]
		public const String Publication = "PUB";
		public const String TableId = "TID";
		public const String FkName = "FKNAME";
		public const String FkTable = "FKTABLE";
		public const String PkTable = "PKTABLE";
		public const String FkField = "FKFIELD";
		public const String PkField = "PKFIELD";
	}
}
